package Demo2.mapper;

import Demo2.bean.Card;
import Demo2.bean.Person;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CardMapper {
    //查全部
    @Select("select * from card")
    @Results({
            @Result(column = "id",property = "id"),
            @Result(column = "number",property = "number"),
            @Result(
                    property = "per", //被包含的实体对象中的属性名称
                    javaType = Person.class, //被包含对象的数据类型
                    column = "pid",//根据这个条件去查Person表

                    one = @One(select ="Demo2.mapper.PersonMapper.selectById" )
            )
    })
    public abstract List<Card> selectAll();
}
